<?php
# Get List of groups of users
$arrUserGroup = explode(",", $USER -> getGroup());

//if(in_array(2,$arrUserGroup) || in_array(3,$arrUserGroup)){
	
	$arrLanguages =  getExistLans();
	
	$arrSections = getXMLSections();
	
	$currentLanguage = "";
	$currentSection = "";
	
	if(count($arrLanguages)!= 0)	
		$currentLanguage = $arrLanguages[0]["x_language"];
		
	if(count($arrSections)!= 0)
		$currentSection = $arrSections[0]["x_section"];
	
	$XML1 = getAllXmlTags($currentLanguage,$currentSection,"");
	
	$obTagsSiteChildren = $XML1 -> getSiteChildrenOfTag($currentLanguage."(root)");
	
	addContent("<table width=\"100%\" id=\"tbTagsTree\"><tr><td width=\"30%\" valign=\"top\">");
	
	addContent("<table>");
	
	foreach ($obTagsSiteChildren -> getTagIDs() as $obTagsId) {

		$obTag  = $obTagsSiteChildren -> getTag($obTagsId);
		
		# Get list of groups authorized to view this tag
		$arrTagAuthorized = $XML1 -> getAuthorizedGroups($obTag->getID());
		
		# Get List of groups of users
		$arrGroupAuthorized= explode(",", $USER -> getGroup());
		
		# Ensure it can be viewed at current authorization
		$flagTagAuthorized = (findArrayInArray($arrTagAuthorized, $arrGroupAuthorized) !== false);
		
		//addContent("test:".$obTag -> getData("x_name")."<br/>");
		
		if($flagTagAuthorized){
		
			if(@$obTagTitle = $XML1 -> getSiteChildrenByName($obTag->getID(),"title")){
				
				$pageTitle = $obTagTitle -> GetAttributeByKey("value");
			
				addContent("<tr><td valign=\"top\" width=\"20%\"><a href=\"javascript:void(0)\" onclick=\"onlick_openSiteParent(this,'".$obTag->getID()."','".$obTag -> getData("x_section")."')\" style=\"text-decoration:none;\">+</a></td><td><a href=\"javascript:void(0)\" onclick=\"onclick_showTitle(this,'".$obTag->getID()."','".$obTagTitle -> getData("x_id")."' )\" title=\"".$pageTitle."\" style=\"text-decoration:none;\">".$pageTitle."</a><div></div></td></tr>");
			}
			else{
				
				addContent("<tr><td valign=\"top\" width=\"20%\"><a href=\"javascript:void(0)\" onclick=\"onlick_openSiteParent(this,'".$obTag->getID()."','".$obTag -> getData("x_section")."')\" style=\"text-decoration:none;\">+</a></td><td><a href=\"javascript:void(0)\" onclick=\"onclick_showTitle(this,'".$obTag->getID()."','' )\" style=\"text-decoration:none;\">".$obTag -> getData("x_name")."</a><div></div></td></tr>");
			}
		}
	}
	
	addContent("</table>");
	
	addContent("</td><td valign=\"top\" align=\"left\" width=\"70%\"><div id=\"dvContentPanel\" align=\"left\"></div></td></tr></table>");
	
//}





?>